#ifndef __ATL_DRI_H__
#define __ATL_DRI_H__
#include <stdint.h>
#include "ux86.h"
#include "ufst.h"
#include <syscall.h>
#ifdef __cplusplus
extern "C"{
#endif
#define DRI_DRIVER_MAGIC 0xC001C0DE
#define DRI_CLASS_CHAR 0x0
#define DRI_CLASS_BLOCK 0x1
	typedef struct dri_driver_descriptor {
		uint32_t driver_magic;
		uint32_t driver_class;
		uint32_t driver_id;
		char	 driver_name[32];
		void *   driver_class_desc;
	} dri_driver_descriptor_t;

typedef void(*dri_interrupt_handler)(registers_t);

void dri_register_interrupt(uint8_t irq, dri_interrupt_handler handler){
	nomalloc_spb.scp_magic = SCP_MAGIC;
	nomalloc_spb.function_id = SC_REGIR;
	nomalloc_spb.parameters[0] = (uint32_t) irq;
	nomalloc_spb.parameters[1] = (uint32_t) handler;
	syscall(&nomalloc_spb);
}

void dri_register_specfile(char *name,uint32_t flags,uint32_t inode,uint32_t mode,read_fs_t read_hook,write_fs_t write_hook){
	nomalloc_spb.scp_magic = SCP_MAGIC;
	nomalloc_spb.function_id = SC_REGSF;
	nomalloc_spb.parameters[0] = (uint32_t) name;
	nomalloc_spb.parameters[1] = flags;
	nomalloc_spb.parameters[2] = inode;
	nomalloc_spb.parameters[3] = mode;
	nomalloc_spb.parameters[4] = (uint32_t) read_hook;
	nomalloc_spb.parameters[5] = (uint32_t) write_hook;
	syscall(&nomalloc_spb);
}
void dri_register_driver(dri_driver_descriptor_t *desc){
	nomalloc_spb.scp_magic = SCP_MAGIC;
	nomalloc_spb.function_id = SC_REGDR;
	nomalloc_spb.parameters[0] = (uint32_t) desc;
	syscall(&nomalloc_spb);
}

#ifdef __cplusplus
}
#endif
#endif